/*
 * Tomer Nuni 300585312
 * Idan Meshita 300043726
 */
import java.awt.Point;


public class Matrix {


	public static final double [][] IDENTITY_MATRIX={{1,0,0},{0,1,0},{0,0,1}};
	
	public static double [] [] multiplyMatrix(double [][] m1,double [][] m2){
		
		
		if (m1[0].length == m2.length){
			int n1=m1.length;
			int n2=m2[0].length;
		
			double m3[][]= new double[n1][n2];
			for (int i = 0; i <m1.length; i++) {
				for (int j = 0; j < m2[0].length; j++) {
					double c = 0;
					for (int k = 0; k <m1[0].length; k++) {
						c+= m1[i][k]*m2[k][j];
					}
					m3[i][j]=c;
					
				}
			}
			return m3;
		}
		return null;
	}

	public static Point multiplyMatrix(double[][] mat, Point point) {
		double [] [] vec = multiplyMatrix( mat,
						new double [][] {{point.x},{point.y},{1}});
		return new Point((int)vec[0][0],(int)vec[1][0]);
	}
	
}
